\(\int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx\) [1264]

   Optimal result
   Rubi [A] (verified)
   Mathematica [F(-1)]
   Maple [B] (verified)
   Fricas [F]
   Sympy [F]
   Maxima [F(-2)]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 20, antiderivative size = 460 \[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}-\frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}-\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}}-\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}} \]

[Out]

1/2*(a+b*arctan(c*x))^2*ln(2*c*((-d)^(1/2)-x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)-I*e^(1/2)))/(-d)^(1/2)/e^(1/2)-1
/2*(a+b*arctan(c*x))^2*ln(2*c*((-d)^(1/2)+x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)+I*e^(1/2)))/(-d)^(1/2)/e^(1/2)-1/
2*I*b*(a+b*arctan(c*x))*polylog(2,1-2*c*((-d)^(1/2)-x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)-I*e^(1/2)))/(-d)^(1/2)/
e^(1/2)+1/2*I*b*(a+b*arctan(c*x))*polylog(2,1-2*c*((-d)^(1/2)+x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)+I*e^(1/2)))/(
-d)^(1/2)/e^(1/2)+1/4*b^2*polylog(3,1-2*c*((-d)^(1/2)-x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)-I*e^(1/2)))/(-d)^(1/2
)/e^(1/2)-1/4*b^2*polylog(3,1-2*c*((-d)^(1/2)+x*e^(1/2))/(1-I*c*x)/(c*(-d)^(1/2)+I*e^(1/2)))/(-d)^(1/2)/e^(1/2
)

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 460, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {5034, 4968} \[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=-\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {e} x+\sqrt {-d}\right )}{\left (\sqrt {-d} c+i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{(1-i c x) \left (c \sqrt {-d}-i \sqrt {e}\right )}\right )}{2 \sqrt {-d} \sqrt {e}}-\frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{(1-i c x) \left (c \sqrt {-d}+i \sqrt {e}\right )}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}}-\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {e} x+\sqrt {-d}\right )}{\left (\sqrt {-d} c+i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}} \]

[In]

Int[(a + b*ArcTan[c*x])^2/(d + e*x^2),x]

[Out]

((a + b*ArcTan[c*x])^2*Log[(2*c*(Sqrt[-d] - Sqrt[e]*x))/((c*Sqrt[-d] - I*Sqrt[e])*(1 - I*c*x))])/(2*Sqrt[-d]*S
qrt[e]) - ((a + b*ArcTan[c*x])^2*Log[(2*c*(Sqrt[-d] + Sqrt[e]*x))/((c*Sqrt[-d] + I*Sqrt[e])*(1 - I*c*x))])/(2*
Sqrt[-d]*Sqrt[e]) - ((I/2)*b*(a + b*ArcTan[c*x])*PolyLog[2, 1 - (2*c*(Sqrt[-d] - Sqrt[e]*x))/((c*Sqrt[-d] - I*
Sqrt[e])*(1 - I*c*x))])/(Sqrt[-d]*Sqrt[e]) + ((I/2)*b*(a + b*ArcTan[c*x])*PolyLog[2, 1 - (2*c*(Sqrt[-d] + Sqrt
[e]*x))/((c*Sqrt[-d] + I*Sqrt[e])*(1 - I*c*x))])/(Sqrt[-d]*Sqrt[e]) + (b^2*PolyLog[3, 1 - (2*c*(Sqrt[-d] - Sqr
t[e]*x))/((c*Sqrt[-d] - I*Sqrt[e])*(1 - I*c*x))])/(4*Sqrt[-d]*Sqrt[e]) - (b^2*PolyLog[3, 1 - (2*c*(Sqrt[-d] +
Sqrt[e]*x))/((c*Sqrt[-d] + I*Sqrt[e])*(1 - I*c*x))])/(4*Sqrt[-d]*Sqrt[e])

Rule 4968

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^2/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(-(a + b*ArcTan[c*x])^2)*(Log[
2/(1 - I*c*x)]/e), x] + (Simp[(a + b*ArcTan[c*x])^2*(Log[2*c*((d + e*x)/((c*d + I*e)*(1 - I*c*x)))]/e), x] + S
imp[I*b*(a + b*ArcTan[c*x])*(PolyLog[2, 1 - 2/(1 - I*c*x)]/e), x] - Simp[I*b*(a + b*ArcTan[c*x])*(PolyLog[2, 1
 - 2*c*((d + e*x)/((c*d + I*e)*(1 - I*c*x)))]/e), x] - Simp[b^2*(PolyLog[3, 1 - 2/(1 - I*c*x)]/(2*e)), x] + Si
mp[b^2*(PolyLog[3, 1 - 2*c*((d + e*x)/((c*d + I*e)*(1 - I*c*x)))]/(2*e)), x]) /; FreeQ[{a, b, c, d, e}, x] &&
NeQ[c^2*d^2 + e^2, 0]

Rule 5034

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_.)*((d_) + (e_.)*(x_)^2)^(q_.), x_Symbol] :> Int[ExpandIntegrand[(a
+ b*ArcTan[c*x])^p, (d + e*x^2)^q, x], x] /; FreeQ[{a, b, c, d, e}, x] && IntegerQ[q] && IGtQ[p, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {\sqrt {-d} (a+b \arctan (c x))^2}{2 d \left (\sqrt {-d}-\sqrt {e} x\right )}+\frac {\sqrt {-d} (a+b \arctan (c x))^2}{2 d \left (\sqrt {-d}+\sqrt {e} x\right )}\right ) \, dx \\ & = -\frac {\int \frac {(a+b \arctan (c x))^2}{\sqrt {-d}-\sqrt {e} x} \, dx}{2 \sqrt {-d}}-\frac {\int \frac {(a+b \arctan (c x))^2}{\sqrt {-d}+\sqrt {e} x} \, dx}{2 \sqrt {-d}} \\ & = \frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}-\frac {(a+b \arctan (c x))^2 \log \left (\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}-\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {i b (a+b \arctan (c x)) \operatorname {PolyLog}\left (2,1-\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{2 \sqrt {-d} \sqrt {e}}+\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {-d}-\sqrt {e} x\right )}{\left (c \sqrt {-d}-i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}}-\frac {b^2 \operatorname {PolyLog}\left (3,1-\frac {2 c \left (\sqrt {-d}+\sqrt {e} x\right )}{\left (c \sqrt {-d}+i \sqrt {e}\right ) (1-i c x)}\right )}{4 \sqrt {-d} \sqrt {e}} \\ \end{align*}

Mathematica [F(-1)]

Timed out. \[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\text {\$Aborted} \]

[In]

Integrate[(a + b*ArcTan[c*x])^2/(d + e*x^2),x]

[Out]

$Aborted

Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 2343 vs. \(2 (362 ) = 724\).

Time = 225.41 (sec) , antiderivative size = 2344, normalized size of antiderivative = 5.10

method result size
parts \(\text {Expression too large to display}\) \(2344\)
derivativedivides \(\text {Expression too large to display}\) \(5222\)
default \(\text {Expression too large to display}\) \(5222\)

[In]

int((a+b*arctan(c*x))^2/(e*x^2+d),x,method=_RETURNVERBOSE)

[Out]

a^2/(e*d)^(1/2)*arctan(e*x/(e*d)^(1/2))+b^2/c*(-1/2*(-(c^2*d*e)^(1/2)*c^2*d+2*c^2*d*e-(c^2*d*e)^(1/2)*e)*c^2/e
/(c^4*d^2-2*c^2*d*e+e^2)*polylog(2,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d-2*(c^2*d*e)^(1/2)-e))*arctan(c*x)
-1/4*I*(-(c^2*d*e)^(1/2)*c^2*d+2*c^2*d*e-(c^2*d*e)^(1/2)*e)*c^2*polylog(3,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-
c^2*d-2*(c^2*d*e)^(1/2)-e))/e/(c^4*d^2-2*c^2*d*e+e^2)+(c^2*d-2*(c^2*d*e)^(1/2)+e)/(c^4*d^2-2*c^2*d*e+e^2)*poly
log(2,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d-2*(c^2*d*e)^(1/2)-e))*arctan(c*x)*c^2-1/4*I*(-(c^2*d*e)^(1/2)*
c^2*d+2*c^2*d*e-(c^2*d*e)^(1/2)*e)*polylog(3,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d-2*(c^2*d*e)^(1/2)-e))/d
/(c^4*d^2-2*c^2*d*e+e^2)-1/3*(-(c^2*d*e)^(1/2)*c^2*d+2*c^2*d*e-(c^2*d*e)^(1/2)*e)*c^2/e/(c^4*d^2-2*c^2*d*e+e^2
)*arctan(c*x)^3-1/2*(c^2*d*e)^(1/2)/d/e*arctan(c*x)*polylog(2,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d+2*(c^2
*d*e)^(1/2)-e))-1/3*(-(c^2*d*e)^(1/2)*c^2*d+2*c^2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*d*e)^(1/2)*e+1/2*a*b/c/d/(c^4*d^2-2*c^2*d*
e+e^2)*polylog(2,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d-2*(c^2*d*e)^(1/2)-e))*(c^2*d*e)^(1/2)*e-a*b/c*(c^2*
d*e)^(1/2)/d/e*arctan(c*x)^2-1/2*a*b/c*(c^2*d*e)^(1/2)/d/e*polylog(2,(c^2*d-e)*(1+I*c*x)^2/(c^2*x^2+1)/(-c^2*d
+2*(c^2*d*e)^(1/2)-e))

Fricas [F]

\[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\int { \frac {{\left (b \arctan \left (c x\right ) + a\right )}^{2}}{e x^{2} + d} \,d x } \]

[In]

integrate((a+b*arctan(c*x))^2/(e*x^2+d),x, algorithm="fricas")

[Out]

integral((b^2*arctan(c*x)^2 + 2*a*b*arctan(c*x) + a^2)/(e*x^2 + d), x)

Sympy [F]

\[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\int \frac {\left (a + b \operatorname {atan}{\left (c x \right )}\right )^{2}}{d + e x^{2}}\, dx \]

[In]

integrate((a+b*atan(c*x))**2/(e*x**2+d),x)

[Out]

Integral((a + b*atan(c*x))**2/(d + e*x**2), x)

Maxima [F(-2)]

Exception generated. \[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((a+b*arctan(c*x))^2/(e*x^2+d),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(e>0)', see `assume?` for more
details)Is e

Giac [F]

\[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\int { \frac {{\left (b \arctan \left (c x\right ) + a\right )}^{2}}{e x^{2} + d} \,d x } \]

[In]

integrate((a+b*arctan(c*x))^2/(e*x^2+d),x, algorithm="giac")

[Out]

sage0*x

Mupad [F(-1)]

Timed out. \[ \int \frac {(a+b \arctan (c x))^2}{d+e x^2} \, dx=\int \frac {{\left (a+b\,\mathrm {atan}\left (c\,x\right )\right )}^2}{e\,x^2+d} \,d x \]

[In]

int((a + b*atan(c*x))^2/(d + e*x^2),x)

[Out]

int((a + b*atan(c*x))^2/(d + e*x^2), x)